import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import remove from '@dfeidao/atom-web/storage/clear';
import get from '@dfeidao/atom-web/storage/get';
import direct_to from '@dfeidao/atom-web/url/direct-to';

export default async function a002(fd: IFeidaoAiBrowserComponent) {
	// todo
	const user = get('user');
	await nodejs('common/zjc-000001/s002', { usercode: user.usercode });
	remove();
	const page_name = fd.data.url.match(/.*\/((.*?)\.html)/)[1];
	const params = fd.data.url.includes('?') ? fd.data.url.substr(fd.data.url.indexOf('?')) : '';
	const backurl = {
		backurl: './' + page_name + params
	};
	direct_to('./login.html', backurl);
}
